home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 41 / Amiga Format CD41 (1999-06)(Future Publishing)(GB)[!][issue 1999-07].iso / -seriously_amiga- / programming / other / scm / slib / syncase.sh < prev    next >
Linux/UNIX/POSIX Shell Script  |  1999-04-19  |  4KB  |  147 lines

  1. #! /bin/sh -e
  2.  
  3. echo Cleaning up old version and unpacking original ...
  4. rm -fr syntax-case
  5. gzip --decompress --stdout syntax-case.tar.z | tar xf -
  6.  
  7. cd syntax-case
  8.  
  9. echo Removing some files ...
  10. rm *.ps loadpp.ss hooks*
  11.  
  12. # Remove enormous amount (about 200k) of white space in expand.pp
  13. echo Slimming expand.pp ...
  14. sed -e '/^ */s///' expand.pp > tt; mv tt expand.pp
  15.  
  16. echo Patching ...
  17. patch -s -b .ORIG << 'PATCH'
  18. --- ./expand.pp.ORIG    Wed Mar 24 19:54:52 1993
  19. +++ ./expand.pp    Wed Mar 24 19:54:52 1993
  20. @@ -337,9 +337,10 @@
  21.  '()
  22.  (lambda (e maps) (regen e)))))
  23.  (ellipsis? (lambda (x)
  24. -(if (if (top-level-bound? 'dp) dp #f)
  25. -(break)
  26. -(void))
  27. +;; I dont know what this is supposed to do, and removing it seemed harmless.
  28. +;; (if (if (top-level-bound? 'dp) dp #f)
  29. +;; (break)
  30. +;; (void))
  31.  (if (identifier? x)
  32.  (free-id=? x '...)
  33.  #f)))
  34. @@ -1674,7 +1675,7 @@
  35.  (set! generate-temporaries
  36.  (lambda (ls)
  37.  (arg-check list? ls 'generate-temporaries)
  38. -(map (lambda (x) (wrap (gensym) top-wrap)) ls)))
  39. +(map (lambda (x) (wrap (new-symbol-hook "g") top-wrap)) ls)))
  40.  (set! free-identifier=?
  41.  (lambda (x y)
  42.  (arg-check id? x 'free-identifier=?)
  43. --- ./expand.ss.ORIG    Thu Jul  2 13:56:19 1992
  44. +++ ./expand.ss    Wed Mar 24 19:54:53 1993
  45. @@ -564,7 +564,8 @@
  46.  
  47.  (define ellipsis?
  48.     (lambda (x)
  49. -      (when (and (top-level-bound? 'dp) dp) (break))
  50. +      ;; I dont know what this is supposed to do, and removing it seemed harmless.
  51. +      ;; (when (and (top-level-bound? 'dp) dp) (break))
  52.        (and (identifier? x)
  53.             (free-id=? x (syntax (... ...))))))
  54.  
  55. @@ -887,7 +888,7 @@
  56.     ;; gensym
  57.     (lambda (ls)
  58.        (arg-check list? ls 'generate-temporaries)
  59. -      (map (lambda (x) (wrap (gensym) top-wrap)) ls)))
  60. +      (map (lambda (x) (wrap (new-symbol-hook "g") top-wrap)) ls)))
  61.  
  62.  (set! free-identifier=?
  63.     (lambda (x y)
  64. --- ./macro-defs.ss.ORIG    Thu Jul  2 12:28:49 1992
  65. +++ ./macro-defs.ss    Wed Mar 24 19:55:31 1993
  66. @@ -161,26 +161,3 @@
  67.         (syntax-case x ()
  68.            ((- e) (gen (syntax e) 0))))))
  69.  
  70. -;;; simple delay and force; also defines make-promise
  71. -
  72. -(define-syntax delay
  73. -   (lambda (x)
  74. -      (syntax-case x ()
  75. -         ((delay exp)
  76. -          (syntax (make-promise (lambda () exp)))))))
  77. -
  78. -(define make-promise
  79. -   (lambda (thunk)
  80. -      (let ([value (void)] [set? #f])
  81. -         (lambda ()
  82. -            (unless set?
  83. -               (let ([v (thunk)])
  84. -                  (unless set?
  85. -                     (set! value v)
  86. -                     (set! set? #t))))
  87. -            value))))
  88. -
  89. -(define force
  90. -   (lambda (promise)
  91. -      (promise)))
  92. -
  93. PATCH
  94. test $# -gt 0 && exit 0
  95. rm *.ORIG
  96. ###############################################################################
  97.  
  98. echo Renaming globals ...
  99.  
  100. CR='
  101. '
  102. SEDCMD='s/list\*/syncase:list*/g'
  103. for x in \
  104.   build- void andmap install-global-transformer eval-hook error-hook \
  105.   new-symbol-hook put-global-definition-hook get-global-definition-hook \
  106.   expand-install-hook;
  107. do SEDCMD=$SEDCMD$CR"s/$x/syncase:$x/g"; done
  108.  
  109. WARN=";;; This file was munged by a simple minded sed script since it left
  110. ;;; its original authors' hands.  See syncase.doc for the horrid details.
  111. "
  112.  
  113. for f in *.pp *.ss; do
  114.   mv $f tt; (echo "$WARN"; sed -e "$SEDCMD" tt) >$f; rm tt; done
  115.  
  116. echo Making the doc file ...
  117. DOC=syncase.doc
  118. cp ../$DOC .
  119. for f in Notes ReadMe; do
  120. echo "
  121. *******************************************************************************
  122. The file named $f in the original distribution:
  123. "
  124. cat $f
  125. rm $f
  126. done >>$DOC
  127.  
  128. echo "
  129. *******************************************************************************
  130. The shell script that created these files out of the original distribution:
  131. " >>$DOC
  132. cat ../fixit >>$DOC
  133.  
  134. echo Renaming files ...
  135. mv compat.ss sca-comp.scm
  136. mv output.ss scaoutp.scm
  137. mv init.ss scaglob.scm
  138. mv expand.pp scaexpp.scm
  139. mv expand.ss sca-exp.scm
  140. mv macro-defs.ss scamacr.scm
  141. mv structure.ss structure.scm
  142.  
  143. echo Adding new pieces ...
  144. cp ../sca-init.scm scainit.scm
  145.  
  146. echo Done.
  147.